const express = require('express');
const router = express.Router();
const request = require('superagent');
const articles = require('../articles');
const execSync = require('child_process').execSync;
const path = require('path');


/* GET home page. */
router.get('/', function (req, res, next) {
    // articles.data.forEach(article => {
    //     const title = article.title.replace(/\s/,'');
    //     const s = 'python3 ' + path.join(__dirname, '../python/Classify.py ') + title;
    //     execSync(s, function (err, stdout, stderr) {
    //             if (err) throw err;
    //             if (stdout) {
    //                 res.send(stdout);
    //             }
    //             if (stderr) {
    //                 res.send(stderr);
    //             }
    //         }
    //     );
    // });
    res.render('index', articles);
});
module.exports = router;
